All Questions
Tagged with sqlrelational-database
58 questions
2votes
1answer
583views
One and only one vs One in crow's foot notation
Am I using one and only one correctly? I have read so many articles online on differences between one and only one vs one and I'm still confused. I.e. a customer can exist with zero, 1 or many (...
11votes
13answers
5kviews
Does it ever make sense to have a one-to-one obligatory relationship in a relational database?
To illustrate what I mean, imagine a group of students and a group of professors in some kind of a traineeship. Every professor is to mentor one student and every student has to be mentored by one and ...
13votes
10answers
9kviews
Is there any benefit to a separate table that is one-to-one with the primary data table?
I've inherited a system with an Oracle relational database with a couple of tables modeled like I've sketched below, where there's an entire child table that only stores a single status code in a one-...
1vote
0answers
147views
Efficient way to implement hierarchical inheritance in SQL?
I am working in a database that has a hierarchy of Companies (From location-level all the way up to Top-level parent company). I am designing a system within that to provide a "subscription" ...
1vote
1answer
465views
How to represent NoSQL entities
I've mainly studied SQL structures, and I know that the representation of the entities can look something like this: However, I'm building this app with MongoDB, so NoSQL DB. I'm aware that MongoDB ...
-3votes
1answer
124views
Where should linking tables be stored? [closed]
I have a system where properties can be stored, and linked with multiple other entities (each with their own schema). Let's say that Documents can be linked with Users and Assets. What is the best ...
-1votes
2answers
221views
Difficulty understanding how denormalization results in more storage necessary
I am having difficulty understanding how denormalization results in more storage necessary. For example, let's say that in a normalized relation, there's Table 1 and Table 2. In order to join Table 1 ...
1vote
3answers
2kviews
Storing count of child rows in parent table
I have two tables, parent and child. Parents can "have" multiple children—in our case they are related through a third table, parent_child_mapping rather than the child storing its parent id ...
4votes
3answers
2kviews
What benefit does a junction table provide over adding an additional field with a foreign key?
Consider this simple example: We have the apartments table below: ID Address 0 555 Maple St 1 123 Oak St 2 999 Pine St We also have the tenants table below: ID Name 0 Bob Foo 1 Jane Bar If I want to ...
1vote
1answer
724views
Synchronizing Multiple Local SQL databases with Server
I'm trying to understand what general mechanisms and/or concepts are available in SQL database last to synchronize local. Here are my inputs and requirements. Multiple clients have a full copy of the ...
2votes
2answers
276views
What is the best practice for hierarchical container - item relationship in a SQL database?
I am in the process of designing a database organizing real world items in different storage locations. One main principle is that items can contain other items. So the relevant table is: An "...
-2votes
2answers
113views
Select from many-to-many in one query
A common issue I run into when building CRUD applications is how to retrieve many-to-many relationships from the database and put them into an object model. Say, for example, I have the following data ...
-3votes
1answer
158views
SQL Server: Which License? Any alternatives?
I'm working on a project which at the moment is not being used for any commercial purposes, and I'm managing the data by using a SQL Server Database. I read here that I should pay for it if I ever ...
-2votes
1answer
74views
Design a database with multiple relations and tables
I'm struggling to find how to correctly design a database in order to store and retrieve data for my software. Basically, I'm designing an application for a gym (C++, MySQL with PhpMyAdmin): each user ...
1vote
1answer
4kviews
SQL Database schema for Catering/Menu management
Background I'm building a Private Chef booking service where you can book a Chef to cook you a custom Menu. I'm having trouble creating a SQL db schema that accurately represents the domain while ...